<?php

require( dirname(__FILE__) . '/../wp-load.php' );
global $wpdb;

  	$id=$_GET['id'];
   	$parentid=$_GET['parentid'];


	if($id!=0)
	{
		$querystr = "SELECT * FROM wp_catalogs WHERE id ='".$id."' ORDER BY listOrder "  ;
		$result=  $wpdb->get_results($querystr);
		if(count($result)>0)
		{
			$name=$result[0]->name;
			$netAddr=$result[0]->netAddr;
		}


	}


?>





<!DOCTYPE html>
<html style="height: 239px; ">
<head>
</head>
<body>
	

	<div>
	<form id="updateAnswerform" method="post" class="form-horizontal" action="#" onsubmit="return savelink();" style="width: 307px; ">
	<table class="table table-bordered">
	<tbody>
					<tr>
					<td class="col-md-2">
						名称
						</td>
						<td>
							<input type="text" id="name" name="name" value="<?php echo  $name; ?>" />
						</td>
					</tr>
					<tr >
						<td>
							网址
						</td>
						<td>
							<input type="text" id="netAddr" name="netAddr" value="<?php echo  $netAddr; ?>" />
						</td>
					</tr>
					
					
				
							
							<td>
						
							
                             <div class="col-md-10" >
						       	<input type="hidden" id="parentid" name="parentid" value="<?php echo  $parentid; ?>" />

								 <input type="hidden" id="id" name="id" value="<?php echo  $id; ?>" />
								 <input type="hidden" id="opt" name="opt" value="101" />
							   <input type="submit" value="提交" />
								
							</div >					
							</td>
							<td>
							  
							 <input type="button" value="取消"  onClick="btnClick()"/>	
							</td>
							</tr>
							</tr>
							<tr id="result"></tr>
							</tbody>
		</table>
		</form>
	</div>
	</div>
	<script src="../catalog/filemanager/jquery.min.js" type="text/javascript"></script>
	<script src="../bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	
	<script src="../catalog/layer/layer.js"></script>


	
	
	<script>

	function btnClick() {  
	
	layer.closeAll();
	}

	
	
	function savelink() {  
	    // jquery 表单提交
		$("#result").html("");
	    $.post("../catalog/GsFileManager.php",{opt:$("#opt").val(),id:$("#id").val(),parentid:$("#parentid").val(),name:$("#name").val(),netAddr:$("#netAddr").val()} ,

			function(data){
				/////
				if(data=="{result: '1'}")
					$("#result").html("成功！");
				else
					$("#result").html("失败！");

			}

		);

   
        return false; // 阻止表单自动提交事件

	}  
	
	</script>

</body>
</html>